import axios from 'axios'
// import { showToast } from 'vant'

const request = axios.create({
  baseURL: 'https://geek.itheima.net/',
})

request.interceptors.request.use(
  (config) => {
    // try {
    // mk.queryUser() 目前会有警告
    const user = mqm.queryUser()
    if (user) {
      config.headers.Authorization = `Bearer ${user}`
    }
    // } catch (e) {
    //   showToast({ message: '慕启明SDK异常' })
    // }
    return config
  },
  (err) => {
    Promise.reject(err)
    console.log('xxxx  ----->  ', 'xxxx')
  },
)

export { request }
